ioemu: Dynamic VNC colour depth.
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 11 Feb 2008 14:55:33 +0000 (14:55 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 11 Feb 2008 14:55:33 +0000 (14:55 +0000)
commit6abc7e7e8c16fcf4deb4819d8d96591739cb8dbd
treea3d7153fd299e80638cc3eaa1aef3db3372defba
parent283dddae870fc59c34dca7242a4988bf82a92c7a
ioemu: Dynamic VNC colour depth.

The qemu vnc server changes its internal colour depth based on the
client request. This way just one colour conversion is done: the one
in  vga_template.h, from the guest colour depth and the vnc server
internal colour depth.

This patch is meant to remove this colour conversion to improve
performances. It accomplishes the goal making the qemu internal colour
depth always the same as the guest colour depth.
The basic idea is that the vnc client is the one that should do the
colour conversion, if necessary. In general it should accept the pixel
format suggested by the server during the initial negotiation. This
behaviour can be set in most vnc clients (vncviewer included).

If the guest changes colour depth, the qemu vnc server changes colour
depth too and notifies the client. The problem is that the vnc
protocol doesn't provide a message from the server to the client to
ask for a colour depth change. So what I am doing is either:

1) quietly starting to do the conversion on vnc server (not gaining
   any performance here);

2) closing the vnc connection with the client, so the client can
   reconnect and choose the new pixel format.

By default I am doing 1), however the second choice can be enabled
passing the -vnc-switch-bpp command line option.
In order to do the colour conversion on the vnc server I had to
improve the colour conversion code already in place because it only
supported conversions from 32 bpp. The patch adds colour conversion
code that support conversions from any resolution to any resolution.

A last note: to get most out of this patch it is best to set Windows
to 16 bit colour depth, because the 24 bit mode is 24 bit depth and 24
bpp, meaning no alpha channel. The vnc protocol doesn't support 24
bpp, only 32 bpp, so this conversion is unavoidable.

From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
tools/ioemu/console.c
tools/ioemu/hw/vga.c
tools/ioemu/sdl.c
tools/ioemu/vl.c
tools/ioemu/vl.h
tools/ioemu/vnc.c
tools/ioemu/vnchextile.h